#Output for methratio file
methratio="/Volumes/web/Mollusk/bs_larvae_exp/AdapterTrimmed_methratio_files/"
#Location of output files
filtered="/Volumes/web/Mollusk/bs_larvae_exp/ID_Target_Loci_Check/"
!grep "[A-Z][A-Z]CG[A-Z]" <{methratio}methratio_out_M1.txt> {filtered}methratio_out_M1_CG.txt
!awk '{if ($8 >= 3) print $1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12}' </Volumes/web/Mollusk/bs_larvae_exp/ID_Target_Loci_Check/methratio_out_M1_CG.txt> /Volumes/web/Mollusk/bs_larvae_exp/ID_Target_Loci_Check/methratio_out_CG3x_M1.txt
!awk '{print ($1"."$2),$5}' </Volumes/web/Mollusk/bs_larvae_exp/ID_Target_Loci_Check/methratio_out_CG3x_M1.txt> /Volumes/web/Mollusk/bs_larvae_exp/ID_Target_Loci_Check/SQL_M1.txt
!sed '/NA/d' {filtered}SQL_M1.txt > {filtered}M1.txt
!head {filtered}SQL_M1.txt
!grep "[A-Z][A-Z]CG[A-Z]" <{methratio}methratio_out_T1D3.txt> {filtered}methratio_out_T1D3_CG.txt
!awk '{if ($8 >= 3) print $1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12}' </Volumes/web/Mollusk/bs_larvae_exp/ID_Target_Loci_Check/methratio_out_T1D3_CG.txt> /Volumes/web/Mollusk/bs_larvae_exp/ID_Target_Loci_Check/methratio_out_CG3x_T1D3.txt
!awk '{print ($1"."$2),$5}' </Volumes/web/Mollusk/bs_larvae_exp/ID_Target_Loci_Check/methratio_out_CG3x_T1D3.txt> /Volumes/web/Mollusk/bs_larvae_exp/ID_Target_Loci_Check/SQL_T1D3.txt
!sed '/NA/d' {filtered}SQL_T1D3.txt > {filtered}T1D3.txt
!head {filtered}T1D3.txt
!grep "[A-Z][A-Z]CG[A-Z]" <{methratio}methratio_out_T1D5.txt> {filtered}methratio_out_T1D5_CG.txt
!awk '{if ($8 >= 3) print $1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12}' </Volumes/web/Mollusk/bs_larvae_exp/ID_Target_Loci_Check/methratio_out_T1D5_CG.txt> /Volumes/web/Mollusk/bs_larvae_exp/ID_Target_Loci_Check/methratio_out_CG3x_T1D5.txt
!awk '{print ($1"."$2),$5}' </Volumes/web/Mollusk/bs_larvae_exp/ID_Target_Loci_Check/methratio_out_CG3x_T1D5.txt> /Volumes/web/Mollusk/bs_larvae_exp/ID_Target_Loci_Check/SQL_T1D5.txt
!sed '/NA/d' {filtered}SQL_T1D5.txt > {filtered}T1D5.txt
!head {filtered}T1D5.txt
!grep "[A-Z][A-Z]CG[A-Z]" <{methratio}methratio_out_M3.txt> {filtered}methratio_out_M3_CG.txt
!awk '{if ($8 >= 3) print $1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12}' </Volumes/web/Mollusk/bs_larvae_exp/ID_Target_Loci_Check/methratio_out_M3_CG.txt> /Volumes/web/Mollusk/bs_larvae_exp/ID_Target_Loci_Check/methratio_out_CG3x_M3.txt
!awk '{print ($1"."$2),$5}' </Volumes/web/Mollusk/bs_larvae_exp/ID_Target_Loci_Check/methratio_out_CG3x_M3.txt> /Volumes/web/Mollusk/bs_larvae_exp/ID_Target_Loci_Check/SQL_M3.txt
!sed '/NA/d' {filtered}SQL_M3.txt > {filtered}M3.txt
!head {filtered}M3.txt
!grep "[A-Z][A-Z]CG[A-Z]" <{methratio}methratio_out_T3D3.txt> {filtered}methratio_out_T3D3_CG.txt
!awk '{if ($8 >= 3) print $1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12}' </Volumes/web/Mollusk/bs_larvae_exp/ID_Target_Loci_Check/methratio_out_T3D3_CG.txt> /Volumes/web/Mollusk/bs_larvae_exp/ID_Target_Loci_Check/methratio_out_CG3x_T3D3.txt
!awk '{print ($1"."$2),$5}' </Volumes/web/Mollusk/bs_larvae_exp/ID_Target_Loci_Check/methratio_out_CG3x_T3D3.txt> /Volumes/web/Mollusk/bs_larvae_exp/ID_Target_Loci_Check/SQL_T3D3.txt
!sed '/NA/d' {filtered}SQL_T3D3.txt > {filtered}T3D3.txt
!head {filtered}T3D3.txt
!grep "[A-Z][A-Z]CG[A-Z]" <{methratio}methratio_out_T3D5.txt> {filtered}methratio_out_T3D5_CG.txt
!awk '{if ($8 >= 3) print $1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12}' </Volumes/web/Mollusk/bs_larvae_exp/ID_Target_Loci_Check/methratio_out_T3D5_CG.txt> /Volumes/web/Mollusk/bs_larvae_exp/ID_Target_Loci_Check/methratio_out_CG3x_T3D5.txt
!awk '{print ($1"."$2),$5}' </Volumes/web/Mollusk/bs_larvae_exp/ID_Target_Loci_Check/methratio_out_CG3x_T3D5.txt> /Volumes/web/Mollusk/bs_larvae_exp/ID_Target_Loci_Check/SQL_T3D5.txt
!sed '/NA/d' {filtered}SQL_T3D5.txt > {filtered}T3D5.txt
!head {filtered}T3D5.txt
#NOTEBOOK NAME
nb='ID_Target_Loci_Check'
#NOTEBOOK LOCATION
nbloc='/Users/claireolson/Dropbox/Lab\ \(1\)/IPython_nbs/Claire/'
#TIMESTAMP
date=!date +%m%d_%H%M
#LOCATION OF POST DIRECTORY
post='/Volumes/web/Mollusk/iPython_Posts/'
cd {post}
!ipython nbconvert {nbloc}{nb} --to html --template full --output {nb}{date}